import 'dart:async';
import 'dart:convert' as JSON;

import 'package:flutter/services.dart';

class FlutterLocation {
  static const MethodChannel _channel = MethodChannel('flutter_location');

  static Future<String?> get platformVersion async {
    final String? version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  /// 初始化定位
  static void initLocation() {
    _channel.invokeMethod("initLocation");
    print(["substring initLocation"]);
    return;
  }

  /// 开始定位
  static Future<Map<String, Object>> startLocation() async {
    String result = await _channel.invokeMethod("getLocation");
    return JSON.jsonDecode(result);
  }
}
